﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Diagnostics;
using DevExpress.XtraEditors;
using DevExpress.Skins;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Ribbon.Gallery;
using DevExpress.Utils.Drawing;
using DevExpress.Utils;
using CustomSecurity;
using GeneralLibs;
using Lists;
using ListForms;
using QuanLyQuy;
using QuanLyKho;
using MuaHang;
using BanHang;
using KeToanTongHop;
using ReportGenerators;
using ReportGenerators.BanHang;
using ReportGenerators.BaoCaoTaiChinh;
using ReportGenerators.MuaHang;
using ReportGenerators.QuanLyKho;
using ReportGenerators.QuanLyQuy;
using ReportGenerators.SoCai;
using ReportGenerators.CongNo;
using ReportGenerators.Thue;
using BanLe;
using BasicForms;

namespace Portal
{
    public partial class FrmCacCauHinh : BasicForms.FrmBase
    {
        public FrmCacCauHinh()
        {
            InitializeComponent();
        }

        private void btnNguoiDung_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
            //CallFunction(e.Item.Tag as string);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        private void customButton1_Click(object sender, EventArgs e)
        {
            CallFunction((sender as System.Windows.Forms.ButtonBase).Tag as string);
        }

        public void CallFunction(string function)
        {
            try
            {
                Form showedForm = null;
                switch (function)
                {
                    #region CauHinh
                    case "FrmCauHinhTenMayTinh":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmCauHinhTenMayTinh)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmCauHinhTenMayTinh();
                        break;
                    #endregion

                    #region DanhMuc
                    case "FrmDanhMucTaiKhoan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucTaiKhoan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucTaiKhoan();
                        break;
                    case "FrmDanhMucTienTe":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucTienTe)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucTienTe();
                        break;
                    case "FrmDanhMucDoiTuongNghiepVu":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucDoiTuongNghiepVu)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucDoiTuongNghiepVu();
                        break;
                    case "FrmDanhMucKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucKho();
                        break;
                    case "FrmDanhMucVatTuHangHoa":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucVatTuHangHoa)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucVatTuHangHoa();
                        break;
                    case "FrmDanhMucDangNhap":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucDangNhap)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucDangNhap();
                        break;
                    case "FrmDanhMucDangXuat":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucDangXuat)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucDangXuat();
                        break;
                    //case "FrmDanhMucVuViec":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucVuViec)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucVuViec();
                    //    break;
                    case "FrmDanhMucThueSuat":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucThueSuat)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucThueSuat();
                        break;
                    //case "FrmDanhMucYeuToChiPhi":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucYeuToChiPhi)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucYeuToChiPhi();
                    //    break;
                    case "FrmDanhMucNhomVatTuHangHoa":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucNhomVatTuHangHoa)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucNhomVatTuHangHoa();
                        break;

                    //#region TaiSanCoDinh
                    //case "FrmDanhMucLoaiTaiSanCoDinh":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLoaiTaiSanCoDinh)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLoaiTaiSanCoDinh();
                    //    break;
                    //case "FrmDanhMucLyDoTangTaiSanCoDinh":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLyDoTangTaiSanCoDinh)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLyDoTangTaiSanCoDinh();
                    //    break;
                    //case "FrmDanhMucLyDoGiamTaiSanCoDinh":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLyDoGiamTaiSanCoDinh)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLyDoGiamTaiSanCoDinh();
                    //    break;
                    //#endregion

                    //#region CongCuDungCu
                    //case "FrmDanhMucLoaiCongCuDungCu":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLoaiCongCuDungCu)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLoaiCongCuDungCu();
                    //    break;
                    //case "FrmDanhMucLyDoTangCongCuDungCu":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLyDoTangCongCuDungCu)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLyDoTangCongCuDungCu();
                    //    break;
                    //case "FrmDanhMucLyDoGiamCongCuDungCu":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhMucLyDoGiamCongCuDungCu)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhMucLyDoGiamCongCuDungCu();
                    //    break;
                    //#endregion

                    case "FrmDanhMucKetChuyen":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhMucKetChuyen)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhMucKetChuyen();
                        break;
                    #endregion

                    #region ChungTu QuanLyQuy
                    case "FrmDanhSachPhieuThu":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuThu)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuThu();
                        break;
                    case "FrmDanhSachPhieuChi":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuChi)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuChi();
                        break;
                    case "FrmDanhSachGiayBaoNo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachGiayBaoNo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachGiayBaoNo();
                        break;
                    case "FrmDanhSachGiayBaoCo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachGiayBaoCo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachGiayBaoCo();
                        break;
                    #endregion

                    #region ChungTu QuanLyKho
                    case "FrmDanhSachPhieuNhapKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuNhapKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuNhapKho();
                        break;
                    case "FrmDanhSachPhieuXuatKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuXuatKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuXuatKho();
                        break;
                    case "FrmDanhSachPhieuChuyenKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuChuyenKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuChuyenKho();
                        break;

                    #endregion

                    #region ChungTu MuaHang
                    case "FrmDanhSachHoaDonMuaHang":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachHoaDonMuaHang)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachHoaDonMuaHang();
                        break;
                    case "FrmDanhSachHangMuaTraLai":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachHangMuaTraLai)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachHangMuaTraLai();
                        break;
                    #endregion

                    #region ChungTu BanHang
                    case "FrmDanhSachHoaDonBanHang":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachHoaDonBanHang)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachHoaDonBanHang();
                        break;
                    case "FrmDanhSachHangBanTraLai":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachHangBanTraLai)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachHangBanTraLai();
                        break;
                    case "FrmThamSoTongHopHangXuatBan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoTongHopHangXuatBan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoTongHopHangXuatBan();
                        break;
                    case "FrmEditHoaDonBanLe":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmEditHoaDonBanLe)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmEditHoaDonBanLe();
                        break;
                    #endregion

                    #region ChungTu KeToanTongHop
                    //case "FrmDanhSachPhieuPhanBoTienLuong":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmDanhSachPhieuPhanBoTienLuong)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmDanhSachPhieuPhanBoTienLuong();
                    //    break;
                    case "FrmDanhSachPhieuKeToan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuKeToan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuKeToan();
                        break;
                    case "FrmDanhSachPhieuKetChuyenTuDong":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDanhSachPhieuKetChuyenTuDong)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDanhSachPhieuKetChuyenTuDong();
                        break;
                    //case "FrmKhoaSo":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmKhoaSo)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmKhoaSo();
                    //    break;
                    #endregion

                    #region TinhToan
                    case "FrmCapNhatGiaXuatKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmCapNhatGiaXuatKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmCapNhatGiaXuatKho();
                        break;
                    #endregion

                    #region BaoCao QuanLyQuy
                    case "FrmThamSoSoChiTietQuyTienMat":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietQuyTienMat)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietQuyTienMat();
                        break;
                    case "FrmThamSoSoQuyTienMat":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoQuyTienMat)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoQuyTienMat();
                        break;
                    #endregion

                    #region BaoCao QuanLyKho
                    case "FrmThamSoTheKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoTheKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoTheKho();
                        break;
                    case "FrmThamSoSoChiTietVatTuHangHoa":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietVatTuHangHoa)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietVatTuHangHoa();
                        break;
                    case "FrmThamSoTongHopNhapXuatTon":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoTongHopNhapXuatTon)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoTongHopNhapXuatTon();
                        break;
                    case "FrmThamSoTongHopHangNhapKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoTongHopHangNhapKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoTongHopHangNhapKho();
                        break;
                    case "FrmThamSoTongHopHangXuatKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoTongHopHangXuatKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoTongHopHangXuatKho();
                        break;
                    case "FrmThamSoBaoCaoTonKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBaoCaoTonKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBaoCaoTonKho();
                        break;
                    #endregion

                    #region BaoCao BanHang
                    case "FrmThamSoSoChiTietBanHang":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietBanHang)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietBanHang();
                        break;
                    #endregion

                    #region BaoCao BanHang
                    case "FrmThamSoBangKeChiTietCongNo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangKeChiTietCongNo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangKeChiTietCongNo();
                        break;
                    #endregion

                    #region SoCai NhatKyChung
                    case "FrmThamSoSoNhatKyChung":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoNhatKyChung)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoNhatKyChung();
                        break;
                    case "FrmThamSoSoNhatKyThuTien":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoNhatKyThuTien)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoNhatKyThuTien();
                        break;
                    case "FrmThamSoSoNhatKyChiTien":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoNhatKyChiTien)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoNhatKyChiTien();
                        break;
                    case "FrmThamSoSoNhatKyMuaHang":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoNhatKyMuaHang)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoNhatKyMuaHang();
                        break;
                    case "FrmThamSoSoNhatKyBanHang":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoNhatKyBanHang)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoNhatKyBanHang();
                        break;
                    case "FrmThamSoSoCaiNKC":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoCaiNKC)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoCaiNKC();
                        break;
                    #endregion

                    #region SoCai NhatKySoCai
                    //case "FrmThamSoNhatKySoCai":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmThamSoNhatKySoCai)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmThamSoNhatKySoCai();
                    //    break;
                    #endregion

                    #region SoCai ChungTuGhiSo
                    case "FrmThamSoChungTuGhiSo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoChungTuGhiSo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoChungTuGhiSo();
                        break;
                    case "FrmThamSoSoDangKyChungTuGhiSo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoDangKyChungTuGhiSo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoDangKyChungTuGhiSo();
                        break;
                    case "FrmThamSoSoCaiCTGS":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoCaiCTGS)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoCaiCTGS();
                        break;
                    #endregion

                    #region SoCai NhatKyChungTu
                    case "FrmThamSoSoCaiNhatKyChungTu":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoCaiNhatKyChungTu)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoCaiNhatKyChungTu();
                        break;
                    case "FrmThamSoNhatKyChungTuSo1":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo1)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo1();
                        break;
                    case "FrmThamSoNhatKyChungTuSo2":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo2)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo2();
                        break;
                    case "FrmThamSoNhatKyChungTuSo3":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo3)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo3();
                        break;
                    case "FrmThamSoNhatKyChungTuSo4":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo4)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo4();
                        break;
                    case "FrmThamSoNhatKyChungTuSo5":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo5)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo5();
                        break;
                    case "FrmThamSoNhatKyChungTuSo6":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo6)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo6();
                        break;
                    //case "FrmThamSoNhatKyChungTuSo7":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmThamSoNhatKyChungTuSo7)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmThamSoNhatKyChungTuSo7();
                    //    break;
                    case "FrmThamSoNhatKyChungTuSo8":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo8)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo8();
                        break;
                    case "FrmThamSoNhatKyChungTuSo9":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo9)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo9();
                        break;
                    case "FrmThamSoNhatKyChungTuSo10":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoNhatKyChungTuSo10)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoNhatKyChungTuSo10();
                        break;
                    #endregion

                    #region SoCai
                    case "FrmThamSoSoChiTietCacTaiKhoan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietCacTaiKhoan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietCacTaiKhoan();
                        break;
                    case "FrmThamSoBangCanDoiSoPhatSinh":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangCanDoiSoPhatSinh)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangCanDoiSoPhatSinh();
                        break;
                    case "FrmThamSoSoTongHopChuT":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoTongHopChuT)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoTongHopChuT();
                        break;
                    case "FrmThamSoBangSoDuCacTaiKhoan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangSoDuCacTaiKhoan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangSoDuCacTaiKhoan();
                        break;
                    #endregion

                    #region CongNo
                    case "FrmThamSoSoChiTietCongNo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietCongNo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietCongNo();
                        break;
                    case "FrmThamSoSoChiTietThanhToan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoSoChiTietThanhToan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoSoChiTietThanhToan();
                        break;
                    case "FrmThamSoBangKeCongNoTheoTaiKhoan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangKeCongNoTheoTaiKhoan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangKeCongNoTheoTaiKhoan();
                        break;
                    #endregion

                    #region Thue
                    case "FrmThamSoBangKeVatDauVao":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangKeVatDauVao)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangKeVatDauVao();
                        break;
                    case "FrmThamSoBangKeVatDauRa":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoBangKeVatDauRa)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoBangKeVatDauRa();
                        break;
                    case "FrmThamSoKeKhaiVatDauRaTT60":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoKeKhaiVatDauRaTT60)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoKeKhaiVatDauRaTT60();
                        break;
                    case "FrmThamSoKeKhaiVatDauVaoTT60":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThamSoKeKhaiVatDauVaoTT60)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThamSoKeKhaiVatDauVaoTT60();
                        break;
                    case "FrmToKhaiVatTT60":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmToKhaiVatTT60)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmToKhaiVatTT60();
                        break;
                    #endregion

                    #region BaoCaoTaiChinh
                    case "FrmThamSoBangCanDoiKeToan":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is ReportGenerators.BaoCaoTaiChinh.FrmThamSoBangCanDoiKeToan)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new ReportGenerators.BaoCaoTaiChinh.FrmThamSoBangCanDoiKeToan();
                        break;
                    case "FrmThamSoBaoCaoKetQuaHoatDongKinhDoanh":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoKetQuaHoatDongKinhDoanh)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoKetQuaHoatDongKinhDoanh();
                        break;
                    case "FrmThamSoBaoCaoLuuChuyenTienTeTrucTiep":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoLuuChuyenTienTeTrucTiep)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoLuuChuyenTienTeTrucTiep();
                        break;
                    case "FrmThamSoBaoCaoLuuChuyenTienTeGianTiep":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoLuuChuyenTienTeGianTiep)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new ReportGenerators.BaoCaoTaiChinh.FrmThamSoBaoCaoLuuChuyenTienTeGianTiep();
                        break;
                    //case "FrmEditChiTieuBaoCao":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is ReportGenerators.BaoCaoTaiChinh.FrmEditChiTieuBaoCao)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new ReportGenerators.BaoCaoTaiChinh.FrmEditChiTieuBaoCao();
                    //    break;
                    #endregion

                    #region NhapSoDu
                    case "FrmSoDuTonKhoKhoaSo":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmSoDuTonKhoKhoaSo)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmSoDuTonKhoKhoaSo();
                        break;
                    #endregion

                    #region Misc
                    case "Help":
                        System.Diagnostics.Process.Start(CommonLib.ThuMucGoc + "\\Help.pdf");
                        break;
                    case "FrmCauHinhGiaoDienChungTu":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmCauHinhFormChungTu)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmCauHinhFormChungTu();
                        break;
                    case "FrmDsUser":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDsUser)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDsUser();
                        break;
                    case "FrmDsRole":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDsRole)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDsRole();
                        break;
                    case "FrmNamTaiChinh":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmNamTaiChinh)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmNamTaiChinh();
                        break;
                    case "FrmEditCachTinhGiaHangTonKho":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmEditCachTinhGiaHangTonKho)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmEditCachTinhGiaHangTonKho();
                        break;
                    case "FrmDsNhatKySuDung":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmDsNhatKySuDung)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmDsNhatKySuDung();
                        break;
                    case "FrmBackupDb":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmBackupDb)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmBackupDb();
                        break;
                    case "FrmRestoreDb":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmRestoreDb)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmRestoreDb();
                        break;
                    case "FrmThongTinDoanhNghiep":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmThongTinCoSoThuoc)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmThongTinCoSoThuoc();
                        break;
                    case "FrmCauHinhTaiKhoanMacDinh":
                        foreach (Form frm in this.OwnedForms)
                        {
                            if (frm is FrmCauHinhTaiKhoanMacDinh)
                            {
                                frm.BringToFront();
                                return;
                            }
                        }
                        showedForm = new FrmCauHinhTaiKhoanMacDinh();
                        break;
                    //case "FrmCauHinhThongSoMacDinhBanLe":
                    //    foreach (Form frm in this.OwnedForms)
                    //    {
                    //        if (frm is FrmCauHinhThongSoMacDinhBanLe)
                    //        {
                    //            frm.BringToFront();
                    //            return;
                    //        }
                    //    }
                    //    showedForm = new FrmCauHinhThongSoMacDinhBanLe();
                    //    break;
                    #endregion
                }

                if (showedForm != null)
                {
                    //AddOwnedForm(showedForm);
                    showedForm.Show();
                    //showedForm.Owner = this;
                }
            }
            catch (Exception ex)
            {
                BasicForms.FrmExceptionNotifier.ShowAndLog(ex);
            }
        }

       
    }
}
